public class text07 {
    public class Text4 {
        public static void main(String[] args) {
            int [] arr = {1,2,3,4,5,6};
            int [] newArr = copyOFRange(arr,1,4);
            for (int i = 0; i < newArr.length; i++) {
                System.out.print(newArr[i] + " ");
            }
        }
        public static int[] copyOFRange(int[] arr,int from,int to){
            //动态初始化，不知道具体数据，知道个数
            int [] arrCopy = new int[to - from];
            int index = 0;
            for(int i = from;i < to;i++){
                arrCopy[index] = arr[i];
                index++;
            }
            return arrCopy;

        }
    }
}
